home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / misc / nroff / ctype.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-06  |  1.0 KB  |  35 lines

  1. #ifndef _CTYPE_H
  2. #define _CTYPE_H
  3.  
  4. #define _U    0x01    /* upper */
  5. #define _L    0x02    /* lower */
  6. #define _D    0x04    /* digit */
  7. #define _C    0x08    /* cntrl */
  8. #define _P    0x10    /* punct */
  9. #define _S    0x20    /* white space (space/lf/tab) */
  10. #define _X    0x40    /* hex digit */
  11. #define _SP    0x80    /* hard space (0x20) */
  12.  
  13. extern unsigned char _ctype[];
  14. extern char _ctmp;
  15.  
  16. #define isalnum(c) ((_ctype+1)[c]&(_U|_L|_D))
  17. #define isalpha(c) ((_ctype+1)[c]&(_U|_L))
  18. #define iscntrl(c) ((_ctype+1)[c]&(_C))
  19. #define isdigit(c) ((_ctype+1)[c]&(_D))
  20. #define isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_D))
  21. #define islower(c) ((_ctype+1)[c]&(_L))
  22. #define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP))
  23. #define ispunct(c) ((_ctype+1)[c]&(_P))
  24. #define isspace(c) ((_ctype+1)[c]&(_S))
  25. #define isupper(c) ((_ctype+1)[c]&(_U))
  26. #define isxdigit(c) ((_ctype+1)[c]&(_D|_X))
  27.  
  28. #define isascii(c) (((unsigned) c)<=0x7f)
  29. #define toascii(c) (((unsigned) c)&0x7f)
  30.  
  31. #define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp)
  32. #define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp)
  33.  
  34. #endif
  35.